package com.twu.biblioteca;

import java.util.Scanner;

public class ReserveBooksHandler extends BookRepository implements Handler {
    public static final String RESERVE_INPUT_PROMPT = "Please input the book name you want to reserve: ";
    public static final String SUCCESS_RESERVE_MESSAGE = "Thank You! Enjoy the book.";
    public static final String FAIL_RESERVE_MESSAGE = "Sorry we don't have that book yet.";

    @Override
    public Object handle() {
        if (books.contains(getUserInput(RESERVE_INPUT_PROMPT))) {
            return SUCCESS_RESERVE_MESSAGE;
        }
        return FAIL_RESERVE_MESSAGE;
    }

    private String getUserInput(String inputPrompt) {
        System.out.print(inputPrompt);
        Scanner scanner = new Scanner(System.in);
        return scanner.nextLine();
    }

}
